<?php

declare (strict_types=1);
/**
 * @copyright 深圳市易果网络科技有限公司
 * @version 1.0.0
 * @link https://dayiguo.com
 */

namespace App\Dao;

use App\Model\Advertising;

/**
 * 广告DAO
 *
 * @author 谢声强(861167322@qq.com)
 * @package App\Dao
 */
class AdvertisingDao extends Dao
{
    /**
     * 通过type获取广告
     *
     * @param int $type 广告类型
     * @return mixed
     */
    public function getAdvertisingByType(int $type = 1)
    {
        return Advertising::query()->where('type', $type)->where('status', 1)->select('title', 'image', 'link')->orderByDesc('sort')->get();
    }
}